package gui;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class OperandView extends JPanel implements ActionListener{
	
	private JTextField opperandOne = new JTextField(10);	
	private JTextField opperandTwo = new JTextField(10);	
	CalculatorModel c;
	
	public OperandView(){
		//Setup the Layout
		this.setLayout(new FlowLayout());
		
		//Add options
		opperandOne.setEditable(false);
		opperandTwo.setEditable(false);		
		
		//Add to view
		this.add(opperandOne);	
		this.add(opperandTwo);
	}
	
	public void actionPerformed(ActionEvent e){
		c = (CalculatorModel) e.getSource();		
		opperandOne.setText(""+c.firstOperand());		
		opperandTwo.setText(""+c.secondOperand());
	}	
	
	public Dimension getPrefferdSize(){
		return new Dimension(50, 50);
	}	
}